package org.msfj.admin.model;

import org.msfj.common.base.BaseModel;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;

@Table(name = "admin_menu")
public class Menu extends BaseModel implements Serializable {
    /**
     * 菜单名称
     */
    @Column(name = "name_")
    private String name;

    /**
     * 菜单类型(0:CURD;1:系统菜单;2:业务菜单;)
     */
    @Column(name = "type_")
    private Integer type;

    /**
     * 上级菜单编号
     */
    @Column(name = "parent_id")
    private String parentId;

    /**
     * 树结构中的索引位置
     */
    @Column(name = "tree_position")
    private String treePosition;

    /**
     * 节点图标CSS类名
     */
    @Column(name = "iconcls_")
    private String iconcls;

    /**
     * 请求地址
     */
    @Column(name = "request_")
    private String request;

    /**
     * 排序号
     */
    @Column(name = "sort_no")
    private Integer sortNo;

    /**
     * 权限标识
     */
    @Column(name = "permission_")
    private String permission;



    /**
     * 获取菜单名称
     *
     * @return name_ - 菜单名称
     */
    public String getName() {
        return name;
    }

    /**
     * 设置菜单名称
     *
     * @param name 菜单名称
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    /**
     * 获取菜单类型(0:CURD;1:系统菜单;2:业务菜单;)
     *
     * @return type_ - 菜单类型(0:CURD;1:系统菜单;2:业务菜单;)
     */
    public Integer getType() {
        return type;
    }

    /**
     * 设置菜单类型(0:CURD;1:系统菜单;2:业务菜单;)
     *
     * @param type 菜单类型(0:CURD;1:系统菜单;2:业务菜单;)
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * 获取上级菜单编号
     *
     * @return parent_id - 上级菜单编号
     */
    public String getParentId() {
        return parentId;
    }

    /**
     * 设置上级菜单编号
     *
     * @param parentId 上级菜单编号
     */
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    /**
     * 获取树结构中的索引位置
     *
     * @return tree_position - 树结构中的索引位置
     */
    public String getTreePosition() {
        return treePosition;
    }

    /**
     * 设置树结构中的索引位置
     *
     * @param treePosition 树结构中的索引位置
     */
    public void setTreePosition(String treePosition) {
        this.treePosition = treePosition == null ? null : treePosition.trim();
    }

    /**
     * 获取节点图标CSS类名
     *
     * @return iconcls_ - 节点图标CSS类名
     */
    public String getIconcls() {
        return iconcls;
    }

    /**
     * 设置节点图标CSS类名
     *
     * @param iconcls 节点图标CSS类名
     */
    public void setIconcls(String iconcls) {
        this.iconcls = iconcls == null ? null : iconcls.trim();
    }

    /**
     * 获取请求地址
     *
     * @return request_ - 请求地址
     */
    public String getRequest() {
        return request;
    }

    /**
     * 设置请求地址
     *
     * @param request 请求地址
     */
    public void setRequest(String request) {
        this.request = request == null ? null : request.trim();
    }

    /**
     * 获取排序号
     *
     * @return sort_no - 排序号
     */
    public Integer getSortNo() {
        return sortNo;
    }

    /**
     * 设置排序号
     *
     * @param sortNo 排序号
     */
    public void setSortNo(Integer sortNo) {
        this.sortNo = sortNo;
    }

    /**
     * 获取权限标识
     *
     * @return permission_ - 权限标识
     */
    public String getPermission() {
        return permission;
    }

    /**
     * 设置权限标识
     *
     * @param permission 权限标识
     */
    public void setPermission(String permission) {
        this.permission = permission == null ? null : permission.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Menu other = (Menu) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
            && (this.getTreePosition() == null ? other.getTreePosition() == null : this.getTreePosition().equals(other.getTreePosition()))
            && (this.getIconcls() == null ? other.getIconcls() == null : this.getIconcls().equals(other.getIconcls()))
            && (this.getRequest() == null ? other.getRequest() == null : this.getRequest().equals(other.getRequest()))
            && (this.getSortNo() == null ? other.getSortNo() == null : this.getSortNo().equals(other.getSortNo()))
            && (this.getPermission() == null ? other.getPermission() == null : this.getPermission().equals(other.getPermission()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getEnable() == null ? other.getEnable() == null : this.getEnable().equals(other.getEnable()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
        result = prime * result + ((getTreePosition() == null) ? 0 : getTreePosition().hashCode());
        result = prime * result + ((getIconcls() == null) ? 0 : getIconcls().hashCode());
        result = prime * result + ((getRequest() == null) ? 0 : getRequest().hashCode());
        result = prime * result + ((getSortNo() == null) ? 0 : getSortNo().hashCode());
        result = prime * result + ((getPermission() == null) ? 0 : getPermission().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getEnable() == null) ? 0 : getEnable().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", parentId=").append(parentId);
        sb.append(", treePosition=").append(treePosition);
        sb.append(", iconcls=").append(iconcls);
        sb.append(", request=").append(request);
        sb.append(", sortNo=").append(sortNo);
        sb.append(", permission=").append(permission);

        sb.append("]");
        return sb.toString();
    }
}
